var a, e = require("../../@babel/runtime/helpers/defineProperty"), t = getApp(), o = require("../../model/douyinModel.js"), i = require("../../model/awconfig.js"), s = require("../../utils/util.js"), n = require("../../ui/dist/base/index").$Toast;

Page({
    data: (a = {
        ksPHost: t.globalData.host,
        downloadHosts: [],
        type: "parseKSVideo",
        icon: "../../images/kuai.jpg",
        showGongZhongHaoBottom: t.globalData.showGongZhongHaoBottom,
        ff: 500,
        localShowBannerAD: 1,
        kItems: t.globalData.adKeyHome + ";" + t.globalData.adKeyDYDownload,
        aMod: 5,
        showVideoBanner: 1,
        interstitialDT: 200,
        interstitialMod: 5,
        onShowCount: 0,
        adBannerType: 1,
        adBannerTypeHome: 1,
        adKeyHome: t.globalData.adKeyHome,
        adKeyDYDownload: t.globalData.adKeyDYDownload,
        adKeyDYVideoInfo: t.globalData.adKeyDYVideoInfo,
        adKeyDYMusic: t.globalData.adKeyDYMusic,
        adKeyUserInifo: t.globalData.adKeyUserInifo,
        adKeyKSDownload: t.globalData.adKeyKSDownload,
        adKeyHSDownload: t.globalData.adKeyHSDownload,
        adKeyAlert: t.globalData.adKeyAlert,
        adKeyMore: t.globalData.adKeyMore,
        adKeyWater: t.globalData.adKeyWater,
        adRewardedVideo1: t.globalData.adRewardedVideo1,
        adInterstitialKSD: t.globalData.adInterstitialKSD,
        adVideoBanner3: t.globalData.adVideoBanner3,
        aSTips: "成功保存到手机，保存位置请看屏幕提示",
        iSTips: "成功保存到手机相册",
        openCustomer: 0,
        customerTitle: "客服",
        ksVideoActionTips: "注意：如果下载视频失败或太慢，请复制无水印链接，用电脑浏览器下载",
        errorTips: "解析失败，请换个网络试试或者联系客服咨询",
        inputTopTips: "解析成功后会出现下载按钮",
        showAlertAD: 0,
        openShareLimit: 0,
        shareLimitTips: "请您先分享小程序到微信群。分享到不同微信群，24小时内无限制使用。点击界面底部绿色按钮“分享小程序到微信群”按钮进行分享。谢谢支持~",
        openRewardedVideoAd: 0,
        rewardedVideoAdTips: "下载视频需要您看完广告视频。看完一次广告视频24小时内无限制下载。",
        expiredTime: "",
        isShare: !1,
        showModal: !1,
        parseBtnText: "解析",
        downloadVideoBtnText: "下载无水印视频",
        downloadVideoDisabled: !1,
        downloadImageBtnText: "下载封面图片",
        downloadImageDisabled: !1,
        queryBtnText: "查询",
        isLoading: !1,
        parseVideoUrl: "",
        parseVideoResult: null,
        videoPlayURL: null,
        inputVideoTxt: "",
        hostFlag: ".",
        parseSTips: "解析成功，点击下载无水印视频，直接保存视频到手机",
        adBannerImageURL: "",
        adBannerWidth: 750,
        adBannerHeight: 200
    }, e(a, "adBannerType", 3), e(a, "showKSDAlertAD", 0), e(a, "openShare", 1), e(a, "shareTips", "免费工具，觉得好用，支持作者，推荐给好友吧"), 
    e(a, "shareGroupText", "推荐小程序到微信群"), e(a, "shareTimeLineText", "获取推荐的二维码图"), e(a, "showTimeLine", 0), 
    e(a, "downloadErrorMsg", "服务器错误，请截图，然后点击联系客服反馈问题。"), e(a, "adAppID", "wx5ad29a508715a79d"), 
    e(a, "adBannerPath", "pages/index/index"), e(a, "list", [ {} ]), e(a, "list_tools", [ {
        title: "使用教程",
        name: "icon",
        color: "white",
        icon: "",
        app_id: "wx4ed902e153b35e79",
        url: "/pages/tutorialImages/tutorialImages"
    }, {
        title: "常见问题",
        name: "layout",
        color: "white",
        icon: "",
        url: "/pages/question/question"
    } ]), a),
    onLoad: function(a) {
        var e = this, t = a.isShare;
        null == t && (t = 0), e.setData({
            navTitle: getApp().globalData.appDisplayName
        });
        var o = a.type;
        null == o && (o = "parseKSVideo");
        var s = [], n = {}, d = "", l = wx.getStorageSync("currentItem");
        null != l && l.length > 0 ? ((n = JSON.parse(decodeURI(l))).open = !0, n.id = o, 
        s[0] = n) : (n.type = "parseKSVideo", n.title = "全网免费去水印", n.desc = "全网免费去水印", n.icon = "../../images/dou.jpg", 
        n.open = !0, n.id = "parseKSVideo", s[0] = n, d = "全网免费不限次数去水印");
        e.setData({
            isShare: t,
            inputVideoTxt: "",
            inputMusicTxt: "",
            type: s[0].id,
            list: s,
            topDesc: d
        }), i.registerConfigCallback(function() {
            e.awconfigSuccessCallback(1);
        }, function(a) {}), e.awconfigSuccessCallback(0), 1 == e.data.openRewardedVideoAd && e.setupVideoAD(), 
        setTimeout(function() {
            e.setData({
                localShowBannerAD: 1
            });
        }, e.data.ff);
        var r = null;
        wx.createInterstitialAd && ((r = wx.createInterstitialAd({
            adUnitId: e.data.adInterstitialKSD
        })).onLoad(function() {}), r.onError(function(a) {}), r.onClose(function() {})), 
        e.setData({
            interstitialAd: r
        });
    },
    awconfigSuccessCallback: function(a) {
        var t, o = wx.getStorageSync("appConfig"), i = this.data.ksPHost;
        null != o.ksPHost && o.ksPHost.length > 0 && (i = o.ksPHost);
        var s = this.data.type;
        null != o.ksType && o.ksType.length > 0 && (s = o.ksType);
        var n = this.data.list;
        null != o.ksList && o.ksList.length > 0 && (n = o.ksList);
        var d = this.data.topDesc;
        null != o.ksTopDesc && o.ksTopDesc.length > 0 && (d = o.ksTopDesc);
        var l = this.data.navTitle;
        null != o.navTitle && (l = o.navTitle);
        var r = this.data.aSTips;
        null != o.aSTips && (r = o.aSTips);
        var h = this.data.iSTips;
        null != o.iSTips && (h = o.iSTips);
        var p = this.data.openCustomer;
        null != o.openCustomer && (p = o.openCustomer);
        var w = this.data.customerTitle;
        null != o.customerTitle && (w = o.customerTitle);
        var u = this.data.ksVideoActionTips;
        null != o.ksVideoActionTips && (u = o.ksVideoActionTips);
        var c = this.data.errorTips;
        null != o.errorTips && (c = o.errorTips);
        var g = this.data.inputTopTips;
        null != o.inputTopTips && (g = o.inputTopTips);
        var T = this.data.downloadHosts;
        null != o.downloadHosts && "" != o.downloadHosts && (T = o.downloadHosts.split(","));
        var D = this.data.openShare;
        null != o.openShare && (D = o.openShare);
        var m = this.data.shareTips;
        null != o.shareTips && (m = o.shareTips);
        var f = this.data.shareGroupText;
        null != o.shareGroupText && (f = o.shareGroupText);
        var x = this.data.shareTimeLineText;
        null != o.shareTimeLineText && (x = o.shareTimeLineText);
        var V = this.data.openShareLimit;
        null != o.openShareLimit && (V = o.openShareLimit);
        var v = this.data.openRewardedVideoAd;
        null != o.openRewardedVideoAd && (v = o.openRewardedVideoAd);
        var S = this.data.rewardedVideoAdTips;
        null != o.rewardedVideoAdTips && (S = o.rewardedVideoAdTips);
        var A = this.data.shareLimitTips;
        null != o.shareLimitTips && (A = o.shareLimitTips);
        var B = this.data.showAlertAD;
        null != o.showAlertAD && (B = o.showAlertAD);
        var y = this.data.parseSTips;
        null != o.parseSTips && (y = o.parseSTips);
        var b = this.data.ff;
        null != o.ff && (b = o.ff);
        var k = this.data.localShowBannerAD;
        null != o.localShowBannerAD && (k = o.localShowBannerAD);
        var I = this.data.kItems;
        null != o.kItems && (I = o.kItems);
        var M = this.data.aMod;
        null != o.aMod && (M = o.aMod);
        var L = this.data.showVideoBanner;
        null != o.showVideoBanner && (L = o.showVideoBanner);
        var P = this.data.adVideoBanner3;
        null != o.adVideoBanner3 && (P = o.adVideoBanner3);
        var K = this.data.adInterstitialKSD;
        null != o.adInterstitialKSD && (K = o.adInterstitialKSD);
        var R = this.data.interstitialDT;
        null != o.interstitialDT && (R = o.interstitialDT);
        var C = this.data.interstitialMod;
        null != o.interstitialMod && (C = o.interstitialMod);
        var U = this.data.adBannerImageURL;
        null != o.adBannerImageURL && (U = o.adBannerImageURL);
        var H = this.data.adBannerWidth;
        null != o.adBannerWidth && (H = o.adBannerWidth);
        var E = this.data.adBannerHeight;
        null != o.adBannerHeight && (E = o.adBannerHeight);
        var F = this.data.adBannerType;
        null != o.adBannerType && (F = o.adBannerType);
        var _ = this.data.showKSDAlertAD;
        null != o.showKSDAlertAD && (_ = o.showKSDAlertAD);
        var G = this.data.adAppID;
        null != o.adAppID && (G = o.adAppID);
        var q = this.data.adBannerPath;
        null != o.adBannerPath && (q = o.adBannerPath);
        var W = this.data.showTimeLine;
        null != o.showTimeLine && (W = o.showTimeLine);
        var Y = this.data.showGongZhongHaoBottom;
        null != o.showGongZhongHaoBottom && (Y = o.showGongZhongHaoBottom);
        var j = this.data.downloadErrorMsg;
        null != o.downloadErrorMsg && (j = o.downloadErrorMsg), this.setData((e(t = {
            ksPHost: i,
            type: s,
            list: n,
            topDesc: d,
            navTitle: l,
            aSTips: r,
            iSTips: h,
            openCustomer: p,
            customerTitle: w,
            ksVideoActionTips: u,
            errorTips: c,
            inputTopTips: g,
            downloadHosts: T,
            openShare: D,
            shareTips: m,
            shareGroupText: f,
            shareTimeLineText: x,
            openShareLimit: V,
            shareLimitTips: A,
            openRewardedVideoAd: v,
            rewardedVideoAdTips: S,
            showAlertAD: B,
            parseSTips: y,
            ff: b,
            localShowBannerAD: k,
            kItems: I,
            aMod: M,
            showVideoBanner: L,
            adVideoBanner3: P,
            adInterstitialKSD: K,
            interstitialDT: R,
            interstitialMod: C,
            adBannerImageURL: U,
            adBannerHeight: E,
            adBannerWidth: H,
            adBannerType: F,
            showKSDAlertAD: _,
            adAppID: G,
            adBannerPath: q
        }, "adBannerPath", q), e(t, "showTimeLine", W), e(t, "showGongZhongHaoBottom", Y), 
        e(t, "downloadErrorMsg", j), t)), wx.setNavigationBarTitle({
            title: this.data.navTitle
        });
    },
    setupVideoAD: function() {
        var a = this, e = t.globalData.systemInfo.SDKVersion;
        if (!(s.compareVersion(e, "2.6.0") < 0)) {
            var o = wx.createRewardedVideoAd({
                adUnitId: a.data.adRewardedVideo1
            });
            o.onLoad(function() {
                a.setData({
                    videoADLoaded: !0
                });
            }), o.onError(function(e) {
                console.log(e), a.setData({
                    videoADLoaded: !1
                });
            }), o.onClose(function(a) {
                a && a.isEnded || void 0 === a ? (s.setExpiredTimeStamp("ExpiredTime"), wx.showToast({
                    title: "看广告成功"
                })) : wx.showToast({
                    title: "没有看完广告"
                });
            }), a.setData({
                rewardedVideoAd: o
            });
        }
    },
    onShow: function() {
        var a = this;
        a.setData({
            onShowCount: a.data.onShowCount + 1
        }), 0 == a.data.openShareLimit ? a.setData({
            expiredTime: ""
        }) : "" == s.getExpiredFormatTime("ExpiredTime") || "" != s.getExpiredFormatTime("ExpiredTime") && s.canMake("ExpiredTime") ? a.setData({
            expiredTime: "全天可使用"
        }) : a.setData({
            expiredTime: "您今天没有分享，限制使用。分享一次到微信群，全天无限制使用。"
        }), 1 == a.data.onShowCount || a.data.onShowCount % a.data.aMod == 0 ? (a.setData({
            tempAD: a.data.localShowBannerAD
        }), setTimeout(function() {
            a.setData({
                tempAD: 1,
                adKeyKSDownload: s.rAK(a.data.kItems)
            });
        }, a.data.ff)) : a.setData({
            tempAD: 1
        }), 1 != a.data.onShowCount && a.data.onShowCount % a.data.interstitialMod != 0 || setTimeout(function() {
            a.data.interstitialAd && a.data.interstitialAd.show().catch(function(a) {
                console.error(a);
            });
        }, a.data.interstitialDT);
    },
    onShareAppMessage: function() {
        return setTimeout(function() {
            console.log("分享成功"), s.setExpiredTimeStamp("ExpiredTime");
        }, 2e3), {
            title: "免费短视频去水印下载",
            path: "/pages/kuaishou/kuaishou?type=" + this.data.type + "&isShare=1",
            success: function(a) {
                console.log("分享成功"), s.setExpiredTimeStamp("ExpiredTime");
            },
            fail: function(a) {}
        };
    },
    bindVideoInput: function(a) {
        this.setData({
            parseVideoUrl: a.detail.value
        });
    },
    bindParseLink: function(a) {
        var e = this;
        wx.getClipboardData({
            success: function(a) {
                if (null != a && null != a && null != a.data && null != a.data && a.data.length > 0) {
                    var t = a.data;
                    console.log(t), e.setData({
                        parseVideoUrl: t,
                        inputVideoTxt: t
                    });
                } else wx.showModal({
                    title: "提示",
                    showCancel: !1,
                    content: "粘贴板没有链接，请从视频APP复制视频链接"
                });
            }
        });
    },
    bindVideoParse: function(a) {
        0 != s.canMake("ExpiredTime") || 1 != this.data.openShareLimit ? null != this.data.parseVideoUrl && "" != this.data.parseVideoUrl ? this.parseVideo() : wx.showToast({
            title: "请输入链接"
        }) : this.showShareTips();
    },
    bindDownloadVideo: function(a) {
        if (null != this.data.parseVideoResult) if (0 == s.canMake("ExpiredTime") && 1 == this.data.openRewardedVideoAd && this.data.videoADLoaded) this.showRewardedVideoAdTips(); else {
            var e = this.data.parseVideoResult.videoURL;
            if (null != e && null != e && "" != e) {
                var t = e.split("/");
                if (t.length >= 3 && t[2]) {
                    var o = t[2];
                    if (wx.reportAnalytics("kshost", {
                        host: o
                    }), this.data.downloadHosts.indexOf(o) > -1) return this.downloadVideoV2(e), void this.setData({
                        hostFlag: "d"
                    });
                }
            }
            var i = this.data.parseVideoResult.realDownloadURL;
            null != i ? this.downloadVideo(i, 1) : wx.showToast({
                title: "请先解析视频"
            });
        } else wx.showToast({
            title: "请先解析视频"
        });
    },
    bindCopyNoWaterURL: function(a) {
        if (null != this.data.parseVideoResult) {
            var e = this.data.parseVideoResult.realDownloadURL;
            null != e && null != e && "" != e ? wx.setClipboardData({
                data: e,
                success: function(a) {
                    wx.showToast({
                        title: "复制成功"
                    });
                }
            }) : wx.showToast({
                title: "请先解析视频"
            });
        } else wx.showToast({
            title: "请先解析视频"
        });
    },
    bindDownloadImage: function(a) {
        if (null != this.data.parseVideoResult) {
            var e = this.data.parseVideoResult.coverURL;
            null == e ? wx.showToast({
                title: "请先解析视频"
            }) : this.downloadImage(e);
        } else wx.showToast({
            title: "请先解析视频"
        });
    },
    bindVideoClear: function(a) {
        this.setData({
            inputVideoTxt: "",
            parseVideoUrl: "",
            parseVideoResult: null,
            videoPlayURL: null,
            resultUIDict: null
        });
    },
    bindCopyText: function(a) {
        console.log(a);
        var e = a.target.dataset.text;
        null != e && "" != e ? wx.setClipboardData({
            data: e,
            success: function(a) {
                wx.showToast({
                    title: "复制成功"
                });
            }
        }) : wx.showToast({
            title: "请先解析视频"
        });
    },
    bindTapSubscription: function(a) {
        wx.setClipboardData({
            data: "西瓜工具",
            success: function(a) {
                wx.showToast({
                    title: "公众号复制成功"
                });
            }
        });
    },
    bindTapWeb: function(a) {
        wx.setClipboardData({
            data: "",
            success: function(a) {
                wx.showToast({
                    title: "官网复制成功"
                });
            }
        });
    },
    bindTapHelp: function(a) {
        wx.navigateTo({
            url: "/pages/help/help"
        });
    },
    bindTapAD: function(a) {
        wx.navigateToMiniProgram({
            appId: this.data.adAppID,
            path: this.data.adBannerPath,
            extraData: {
                foo: "bar"
            },
            envVersion: "release",
            success: function(a) {}
        });
    },
    modalConfirm: function() {
        this.setData({
            showModal: !1
        });
    },
    parseVideo: function() {
        var a = this, e = "请输入快首链接", i = "请输入快首链接";
        if ("parseKSVideo" == a.data.type ? (e = "请输入快首链接", i = "解析失败，请检查链接是否为快首视频链接或者网络是否正常", 
        wx.reportAnalytics("parse", {
            platform: "kuaishou"
        })) : "parseHSVideo" == a.data.type && (e = "请输入火杉链接", i = "解析失败，请检查链接是否为火杉视频链接或者网络是否正常", 
        wx.reportAnalytics("parse", {
            platform: "huoshan"
        })), null != a.data.parseVideoUrl && "" != a.data.parseVideoUrl) if (1 != a.data.isLoading) {
            var d = {
                sourceURL: a.data.parseVideoUrl
            };
            a.setData({
                parseBtnText: "解析中",
                isLoading: !0
            }), o.getKSVideoInfo(d, a.data.ksPHost, function(e) {
                if (a.setData({
                    parseBtnText: "解析",
                    isLoading: !1
                }), console.log(e), console.log(e.errorMessage), 1010 == e.status && (wx.setStorageSync(s.getAuthTokenKey(), ""), 
                t.login()), 0 == e.status) {
                    var o = e.data;
                    a.setData({
                        parseVideoResult: o,
                        downloadVideoBtnText: "下载无水印视频"
                    }), "image" == o.type ? a.toImageDetail() : n({
                        content: a.data.parseSTips,
                        duration: "3",
                        mask: !1
                    }), "video" == o.type && a.setData({
                        videoPlayURL: o.realDownloadURL
                    });
                } else if (null != e.errorMessage) {
                    "model" == e.errorAlertType ? wx.showModal({
                        title: "提示",
                        content: e.errorMessage
                    }) : wx.showToast({
                        title: e.errorMessage
                    });
                } else wx.reportAnalytics("parse_fail", {
                    source_link: a.data.parseVideoUrl
                }), wx.showModal({
                    title: "提示",
                    content: i
                });
            }, function(e) {
                wx.reportAnalytics("parse_fail", {
                    source_link: a.data.parseVideoUrl
                }), a.setData({
                    parseBtnText: "解析",
                    isLoading: !1
                });
            });
        } else wx.showToast({
            title: "正在处理中"
        }); else wx.showToast({
            title: e
        });
    },
    getHost: function(a) {
        var e = wx.getStorageSync("appConfig"), t = 10;
        null != e && e.hwks1 && (t = e.hwks1);
        var o = 0;
        null != e && e.hwks2 && (o = e.hwks2);
        var i = 0;
        null != e && e.hwks3 && (i = e.hwks3);
        var n = "https://d3.fccabc.com/";
        null != e && e.hostks1 && (n = e.hostks1);
        var d = "https://d.fccabc.com/";
        null != e && e.hostks2 && (d = e.hostks2);
        var l = "https://d.fccabc.com/";
        null != e && e.hostks3 && (l = e.hostks3);
        var r = [ {
            host: n,
            weight: t
        }, {
            host: d,
            weight: o
        }, {
            host: l,
            weight: i
        } ], h = n, p = s.weightRand(r);
        return console.log("result host:" + p), p && null != p && (h = p), 1 != a && (h = n), 
        -1 != h.indexOf(d) ? this.setData({
            hostFlag: "2"
        }) : -1 != h.indexOf(l) ? this.setData({
            hostFlag: "3"
        }) : this.setData({
            hostFlag: "1"
        }), h;
    },
    downloadVideo: function(a, e) {
        var o = this;
        "parseKSVideo" == o.data.type ? wx.reportAnalytics("download", {
            platform: "kuaishou"
        }) : "parseHSVideo" == o.data.type && wx.reportAnalytics("download", {
            platform: "huoshan"
        });
        var i = o.getHost(e) + "pksr?s=temp.mp4";
        1 == e ? o.setData({
            downloadVideoBtnText: "下载中",
            downloadVideoDisabled: !0
        }) : o.setData({
            downloadVideoBtnText: "正在重试...",
            downloadVideoDisabled: !0
        });
        var n = {
            ssu: a
        };
        o.downloadTask = wx.downloadFile({
            url: i,
            header: s.buildHeader(n),
            success: function(i) {
                200 === i.statusCode ? (o.setData({
                    downloadVideoBtnText: "保存中"
                }), o.setData({
                    tempVideoFilePath: i.tempFilePath
                }), console.log(i.tempFilePath), wx.saveVideoToPhotosAlbum({
                    filePath: i.tempFilePath,
                    success: function(a) {
                        if (-1 != o.data.adBannerType && 1 == o.data.showAlertAD) o.setData({
                            downloadVideoBtnText: "下载无水印视频",
                            downloadVideoDisabled: !1,
                            showModal: !0
                        }); else {
                            var e = o.data.aSTips;
                            "ios" == t.globalData.systemInfo.platform && (e = o.data.iSTips), wx.showModal({
                                showCancel: !1,
                                title: "保存成功",
                                content: e
                            });
                        }
                        console.log(a.errMsg);
                    },
                    fail: function(a) {
                        wx.showToast({
                            title: "保存失败"
                        }), o.setData({
                            downloadVideoBtnText: "下载无水印视频",
                            downloadVideoDisabled: !1
                        });
                    }
                })) : 1 == e ? (console.log("重试"), o.setData({
                    downloadVideoBtnText: "正在重试...",
                    downloadVideoDisabled: !0
                }), o.downloadVideo(a, e + 1)) : wx.showModal({
                    title: "下载失败",
                    content: o.data.downloadErrorMsg
                });
            },
            fail: function(t) {
                t.errMsg;
                wx.reportAnalytics("download_fail", {
                    link: i,
                    source_link: o.data.parseVideoUrl
                }), 1 == e ? (console.log("重试"), o.setData({
                    downloadVideoBtnText: "正在重试...",
                    downloadVideoDisabled: !0
                }), o.downloadVideo(a, e + 1)) : wx.showModal({
                    title: "下载失败",
                    content: o.data.downloadErrorMsg
                });
            },
            complete: function() {
                "正在重试..." == o.data.downloadVideoBtnText && 1 == e || (o.downloadTask = null, o.setData({
                    loading: !1
                }), o.setData({
                    downloadVideoBtnText: "下载无水印视频",
                    downloadVideoDisabled: !1
                }));
            }
        }), o.downloadTask.onProgressUpdate(function(a) {
            o.setData({
                progress: Math.round(100 * a.progress)
            }), o.setData({
                downloadVideoBtnText: "下载中：" + a.progress + "%"
            });
        });
    },
    downloadVideoV2: function(a) {
        var e = this;
        null != a ? (e.setData({
            downloadVideoDisabled: !0
        }), e.downloadTask = wx.downloadFile({
            url: a,
            success: function(a) {
                200 === a.statusCode ? (e.setData({
                    downloadVideoBtnText: "保存中"
                }), e.setData({
                    tempVideoFilePath: a.tempFilePath
                }), console.log(a.tempFilePath), wx.saveVideoToPhotosAlbum({
                    filePath: a.tempFilePath,
                    success: function(a) {
                        -1 != e.data.adBannerType && 1 == e.data.showAlertAD ? e.setData({
                            downloadVideoBtnText: "下载无水印视频",
                            downloadVideoDisabled: !1,
                            showModal: !0
                        }) : wx.showModal({
                            showCancel: !1,
                            title: "保存成功",
                            content: "成功保存到手机相册"
                        }), console.log(a.errMsg);
                    },
                    fail: function(a) {
                        wx.showToast({
                            title: "保存失败"
                        }), e.setData({
                            downloadVideoBtnText: "下载无水印视频",
                            downloadVideoDisabled: !1
                        });
                    }
                })) : wx.showModal({
                    title: "下载失败",
                    content: e.data.downloadErrorMsg
                });
            },
            fail: function(t) {
                t.errMsg;
                console.log("下载失败=====" + a), console.log("下载失败原链接=====" + e.data.parseVideoUrl), 
                wx.reportAnalytics("download_fail", {
                    link: a,
                    source_link: e.data.parseVideoUrl
                }), wx.showModal({
                    title: "下载失败",
                    content: e.data.downloadErrorMsg
                });
            },
            complete: function() {
                e.downloadTask = null, e.setData({
                    loading: !1
                }), e.setData({
                    downloadVideoBtnText: "下载无水印视频",
                    downloadVideoDisabled: !1
                });
            }
        }), e.downloadTask.onProgressUpdate(function(a) {
            e.setData({
                progress: Math.round(100 * a.progress)
            }), e.setData({
                downloadVideoBtnText: "下载中：" + a.progress + "%"
            });
        })) : wx.showToast({
            title: "链接错误"
        });
    },
    downloadImage: function(a) {
        var e = this;
        "https://" == a.substring(0, 8) || (a = a.replace("http://", "https://")), e.setData({
            downloadImageBtnText: "下载中",
            downloadImageDisabled: !0
        });
        a = e.getHost(1) + "pksri?s=" + encodeURIComponent(a);
        e.downloadTask = wx.downloadFile({
            url: a,
            header: s.buildHeader({}),
            success: function(a) {
                e.setData({
                    downloadImageBtnText: "保存中"
                }), e.setData({
                    tempImageFilePath: a.tempFilePath
                }), console.log(a.tempFilePath), wx.saveImageToPhotosAlbum({
                    filePath: a.tempFilePath,
                    success: function(a) {
                        e.setData({
                            downloadImageBtnText: "下载封面图片",
                            downloadImageDisabled: !1
                        }), console.log(a.errMsg);
                        var o = e.data.aSTips;
                        "ios" == t.globalData.systemInfo.platform && (o = e.data.iSTips), wx.showModal({
                            showCancel: !1,
                            title: "保存成功",
                            content: o
                        });
                    },
                    fail: function(a) {
                        wx.showToast({
                            title: "保存失败"
                        }), console.log(a), e.setData({
                            downloadImageBtnText: "下载封面图片",
                            downloadImageDisabled: !1
                        });
                    }
                });
            },
            fail: function(a) {
                a.errMsg;
                wx.showToast({
                    title: "下载失败"
                });
            },
            complete: function() {
                e.downloadTask = null, e.setData({
                    loading: !1
                }), e.setData({
                    downloadImageBtnText: "下载封面图片",
                    downloadImageDisabled: !1
                });
            }
        }), e.downloadTask.onProgressUpdate(function(a) {
            e.setData({
                progress: Math.round(100 * a.progress)
            }), e.setData({
                downloadImageBtnText: "下载中：" + a.progress + "%"
            });
        });
    },
    downloadShareImage: function(a) {
        var e = wx.getStorageSync("appConfig"), t = "https://ws3.sinaimg.cn/large/005BYqpgly1fxgok44r0gj30go0gognl.jpg";
        null != e.shareImageURL && (t = e.shareImageURL), wx.showToast({
            title: "下载图片中..."
        }), wx.downloadFile({
            url: t,
            success: function(a) {
                wx.hideToast(), 200 === a.statusCode && (console.log(a.tempFilePath), wx.saveImageToPhotosAlbum({
                    filePath: a.tempFilePath,
                    success: function(a) {
                        wx.showToast({
                            title: "保存到相册成功"
                        });
                    },
                    fail: function(a) {
                        wx.showToast({
                            title: "保存失败"
                        });
                    }
                }));
            },
            fail: function(a) {
                a.errMsg;
                wx.hideToast();
            }
        });
    },
    tapTutorial: function(a) {
        wx.navigateTo({
            url: "/pages/tutorialImages/tutorialImages"
        });
    },
    showShareTips: function() {
        this.selectComponent("#dialog").showDialog();
    },
    showRewardedVideoAdTips: function() {
        var a = this;
        wx.showModal({
            title: "提示",
            confirmText: "看广告",
            cancelText: "取消",
            content: a.data.rewardedVideoAdTips,
            success: function(e) {
                e.confirm ? a.showRewardedVideoAd() : e.cancel && console.log("用户点击取消");
            }
        });
    },
    showRewardedVideoAd: function() {
        var a = this.data.rewardedVideoAd;
        a.show().catch(function(e) {
            a.load().then(function() {
                return a.show();
            });
        });
    },
    _cancelEvent: function() {
        console.log("你点击了取消"), this.selectComponent("#dialog").hideDialog();
    },
    _confirmEvent: function() {
        console.log("你点击了确定"), this.selectComponent("#dialog").hideDialog();
    },
    toHome: function(a) {
        1 == this.data.isShare ? (wx.reLaunch({
            url: "/pages/home/home"
        }), wx.navigateBack({})) : wx.navigateBack({});
    },
    toImageDetail: function() {
        var a = this.data.parseVideoResult;
        console.log("toImageDetail"), console.log(a), "image" == a.type ? (wx.setStorageSync("ImagesTemp", JSON.stringify(a)), 
        wx.navigateTo({
            url: "/pages/imageDetail/imageDetail?title=快首图集"
        })) : wx.showToast({
            title: "没有图集"
        });
    },
    kindToggle: function(a) {
        for (var e = a.currentTarget.id, t = this.data.list, o = 0, i = t.length; o < i; ++o) t[o].id == e ? t[o].open = !t[o].open : t[o].open = !1;
        this.setData({
            list: t
        });
    },
    toChild: function(a) {
        a.currentTarget.dataset.index;
        var e = a.currentTarget.dataset.url;
        console.log(e), wx.navigateTo({
            url: e
        });
    }
});